<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>数组的拆分与合并</title>
</head>
<body>
    <script>
        // let str = "kgdl,gjdkg";

        // // 字符串拆分成数组
        // let arr = str.split(",");
        // console.log(arr);

        // // 数组合并成字符串
        // let str1 = arr.join("-");
        // console.log(str1);



        let arr1 = [1,2,3,4,5];
        let arr2 = ["gdsfg","gdfsg","gfsgr"];
        let arr3 = ["hjgfj","jfskag","jfhgfg"];

        // 合并多个数组，方法一
        // arr1 = arr1.concat(arr2,arr3);
        // console.log(arr1);

        // 合并多个数组，方法二
        // arr1 = [...arr1,...arr2,...arr3];
        // console.log(arr1);


        // 将数组的指定元素复制到指定位置
        // arr.copyWithin(指定开始位置,指定元素的起始位置，指定元素的结束位置+1)
        // arr1 = arr1.copyWithin(2,0,2);
        arr1 = arr1.copyWithin(1,3,5);
        console.log(arr1);        
    </script>
</body>
</html>